/**
 * Created by cqmcqm on 2015/6/2.
 */


var FESW=FESW||function(){};

/**
 * 创建canvas
 */
FESW.prototype.addCanvas=function()
{
    this.canvas=document.createElement('canvas');
    this.ctx=this.canvas.getContext(this.canvas,'2d');
}

/**
 * 创建矩形,通过draw绘制
 */
FESW.prototype.createRect=function(x,y,width,height,centerFlg,fillFlg)
{
    var rect={};
    if(centerFlg){
        x-=width/2;
        y-=height/2;
    }
    rect.draw=function(){
        (fillFlg?this.ctx.fillRect:this.ctx.strokeRect)(x,y,width,height)
    };
    return rect;
}



